package cn.longwingstech.intelligence.bibackend.mq;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class TtlConfig {


    @Bean("xExchange")
    public Exchange xExchange() {
        return new DirectExchange(MqEnums.GEN.getExchange());
    }
    @Bean("genQueue")
    public Queue screenshotsQueue() {
        return QueueBuilder.durable(MqEnums.GEN.getQueue()).build();
    }
    @Bean("xExchangeBindGenQueue")
    public Binding xExchangeBindScreenshotsQueue(@Qualifier("xExchange") Exchange xExchange
            , @Qualifier("genQueue") Queue screenshotsQueue) {

        return BindingBuilder.bind(screenshotsQueue).to(xExchange).with(MqEnums.GEN.getRoutingKey()).noargs();
    }
}
